﻿<UserControl x:Class="Plugins.UserControls.HourSelector"

             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             
             xmlns:Converters="clr-namespace:Utils.Wpf.Converters;assembly=Utils"
             xmlns:Wpf="clr-namespace:Utils.Wpf;assembly=Utils" xmlns:UserControls="clr-namespace:Plugins.UserControls"
             Background="#1F1F1F"
             
             mc:Ignorable="d"
             
             d:DesignHeight="130" 
             d:DataContext="{d:DesignInstance Type=UserControls:HourSelectorVM}" >

    <UserControl.Resources>
        <ResourceDictionary>
            <Converters:BooleanNotConverter x:Key="BooleanNotConverter" />
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\PluginTheme.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
			<ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

		<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" VerticalAlignment="Center" Text="Hour Limits" HorizontalAlignment="Center" Margin="6" />

        <CheckBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,3,3,3" Content="From Opening" IsChecked="{Binding StartWithOpening, Mode=TwoWay}" VerticalAlignment="Center" >
            <CheckBox.ToolTip>
                <StackPanel>
                    <TextBlock Foreground="Black" FontWeight="Bold" Text="OperationStartDate with Opening" />
                    <TextBlock Foreground="Black" Text="Calculate the first bar from the opening of the market." />
                </StackPanel>
            </CheckBox.ToolTip>
        </CheckBox>
        <TextBlock Grid.Row="1" Grid.Column="0" Margin="3,3,6,3" Text="Start" VerticalAlignment="Center" />
        <TextBlock Grid.Row="3" Grid.Column="0" Margin="3,3,6,3" Text="Last Open" VerticalAlignment="Center" />
        <Wpf:TimePicker Grid.Row="2" Grid.Column="1" Foreground="{StaticResource FontBrush}" ShowCheckBox="False" ShowDropDown="False" Format="Time" Value="{Binding OperationStart, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=TwoWay}" IsEnabled="{Binding StartWithOpening, Converter={StaticResource BooleanNotConverter}}" Margin="1" >
            <Wpf:TimePicker.ToolTip>
                <StackPanel>
                    <TextBlock Foreground="Black" FontWeight="Bold" Text="OperationStartDate Time" />
                    <TextBlock Foreground="Black" Text="The engine will discard all the quotations before the start time." />
                </StackPanel>
            </Wpf:TimePicker.ToolTip>
        </Wpf:TimePicker>
        <Wpf:TimePicker Grid.Row="3" Grid.Column="1" Foreground="{StaticResource FontBrush}" ShowCheckBox="False" ShowDropDown="False" Format="Time" Value="{Binding LastOpen, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=TwoWay}" Margin="1" >
            <Wpf:TimePicker.ToolTip>
                <StackPanel>
                    <TextBlock Foreground="Black" FontWeight="Bold" Text="Last Open" />
                    <TextBlock Foreground="Black" Text="The engine will not open new operations after the last open time." />
                </StackPanel>
            </Wpf:TimePicker.ToolTip>
        </Wpf:TimePicker>
        <TextBlock Grid.Row="4" Grid.Column="0" Margin="3,3,6,3" Text="Forced Close" VerticalAlignment="Center" />
        <Wpf:TimePicker Grid.Row="4" Grid.Column="1" Foreground="{StaticResource FontBrush}" ShowCheckBox="False" ShowDropDown="False" Format="Time" Value="{Binding ForcedCloseTime, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=TwoWay}" Margin="1" >
            <Wpf:TimePicker.ToolTip>
                <StackPanel>
                    <TextBlock Foreground="Black" FontWeight="Bold" Text="Floced Closing Time" />
                    <TextBlock Foreground="Black" Text="The engine will close any opened operation at market price when the forced close time is reached." />
                </StackPanel>
            </Wpf:TimePicker.ToolTip>
        </Wpf:TimePicker>
    </Grid>
</UserControl>
